package p0;

/**
 * @author pengjz <br>
 * @version 1.0 <br>
 * @description Leetcode_20_1 <br>
 * @date 2021/3/2 23:40 <br>
 */
public class Leetcode_20_1 {

    /**
     * 投机取巧，重复替换可能的括号
     * @param s
     * @return
     */
    public boolean isValid(String s) {
        while (s.contains("{}")
                || s.contains("[]")
                || s.contains("()")) {
            s = s.replace("[]", "");
            s = s.replace("{}", "");
            s = s.replace("()", "");
        }
        return "".equals(s);
    }

    public static void main(String[] args) {

    }
}
